package com.food.admin.util;

public class RedisKeyUtil {
    /**
     * 存储注册手机验证码的RedisKey
     */
    public static String registerCodeKey(String phone) throws Exception{
        return "register:phone:"+phone;
    }
    /**
     * 存储登录手机验证码的RedisKey
     */
    public static String loginCodeKey(String phone) throws Exception{
        return "login:phone:"+phone;
    }

    /**
     * 存储注册业务一分钟内是否发送过手机验证码的Rediskey
     */
    public static String registerCodeOnMinuteKey(String phone) throws Exception{
        return "register:codeonminute:phone:"+phone;
    }

    /**
     * 存储一小时内发送验证码的次数Rediskey
     */
    public static String codeOnHourKey(String phone) throws Exception{
        return "codeonhour:phone:"+phone;
    }
    /**
     * 存储用户收藏书籍的Rediskey
     */
    public static String collectBookByUser(Integer userId) throws Exception{
        return "collectBook:book:userId:"+userId;
    }
    /**
     * 存储收藏排行榜的Rediskey
     */
    public static String bookCollectRank() throws Exception{
        return "book:collect:rank";
    }
    /**
     * 树形类别列表缓存数据的Rediskey
     */
    public static String bookTreeList()throws Exception{
        return "cache:booktype:tree";
    }
    /**
     * 根据书籍类型查询所有该类型子节点的Rediskey
     */
    public static String selfBookType(String typeId)throws Exception{
        return "self:booktype:typeid:"+typeId;
    }
    /**
     * 用户的购物车列表的Rediskey 看用户有哪些购物清单里面
     */
    public static String userCartKey(Integer userId)throws Exception{
        return "cart:userid:"+userId;
    }
    /**
     * 具体那一条购物车记录的Rediskey
     */
    public static String cartInfoKey(Integer cartId)throws Exception{
        return "cart:cartId:"+cartId;
    }
    /**
     * 注册业务手机号码分布式锁key
     */
    public static String lockPhoneRegister(String phone)throws Exception{
        return "lock:register:phone:"+phone;
    }
    /**
     * 注册业务用户名分布式锁key
     */
    public static String lockUsernameRegister(String userName)throws Exception{
        return "lock:register:username:"+userName;
    }
    /**
     * 用户的购物车列表key
     * */
    public static String cartUserKey(String userId){
        return "cart:userid:"+userId;
    }
    /**
     * 某一条购物车记录的key
     */
    public static String cartInfoKey(String cartId){
        return "cart:cartId:"+cartId;
    }
    /**
     * 得到存放商品库存得hashkey
     */
    public static String getProductConts() throws Exception{
        return "product:conts";
    }

}
